<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .box {
        width: 100px;
        height: 100px;
        background-color: aqua;
      }
      .v-enter {
        background-color: blue;
      }
      .v-enter-active {
        transition: all 2s linear;
      }
      /* 进入动画结束之后 会移除所有的样式名 */
      .v-enter-to {
        background-color: brown;
      }
      .v-leave {
        background-color: cornflowerblue;
      }
      .v-leave-active {
        transition: all 2s linear;
      }
      .v-leave-to {
        background-color: red;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <button @click="toggle">toggle</button>
      <transition>
        <div class="box" v-show="isShow"></div>
      </transition>
    </div>
  </body>
  <script src="./node_modules/vue/dist/vue.js"></script>
  <script>
    const vm = new Vue({
      el: '#app',
      data() {
        return {
          isShow: true
        }
      },
      methods: {
        toggle() {
          this.isShow = !this.isShow
        }
      }
    })
  </script>
</html>
